package com.example.dw.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.dw.entity.Bulletin;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 公告Mapper接口
 * @author system
 * @since 2024-01-01
 */
@Mapper
public interface BulletinMapper extends BaseMapper<Bulletin> {

    /**
     * 获取公告列表（显示的）
     */
    @Select("SELECT * FROM bulletin WHERE isShow = '1' ORDER BY bulletinId DESC")
    List<Bulletin> getBulletinList();

    /**
     * 获取最新公告
     */
    @Select("SELECT * FROM bulletin WHERE isShow = '1' ORDER BY bulletinId DESC LIMIT 1")
    Bulletin getLatestBulletin();
} 